package com.sanyang.pda.presenter;


import com.sanyang.pda.bean.ManualPickingBean;
import com.sanyang.pda.contract.ManualOutBoundContract;
import com.sanyang.pda.net.NetUtils;
import com.wangshen.base.net.bean.BaseRowsAppEntity;
import com.wangshen.base.ui.mvp.base.presenter.BasePresenter;

import java.util.List;

import io.reactivex.functions.Consumer;

public class ManualOutBoundPresenter extends BasePresenter<ManualOutBoundContract.View> implements ManualOutBoundContract.Presenter {


    @Override
    public void manualPickingList(int num) {
        NetUtils.geApi().manualPickingList(num,10)
                .compose(this.handleEverythingResult())
                .subscribe(new Consumer<BaseRowsAppEntity<List<ManualPickingBean>>>() {
                    @Override
                    public void accept(BaseRowsAppEntity<List<ManualPickingBean>> listBaseRowsAppEntity) throws Exception {
                        getView().setList(listBaseRowsAppEntity.getRows());
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        getView().showMessage(throwable.getMessage());
                    }
                });
    }
}
